const Upyun = require('../../utils/upyun-wxapp-sdk')
const upyun = new Upyun({
  bucket: 'feijiu-img5',
  operator: 'feijiu',
  getSignatureUrl: 'https://zsbpt.zaisubao.cn/index.php/Api/Feijiu/getSignature'
  // getSignatureUrl: 'https://v0.api.upyun.com'
})
let date = new Date;
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
const minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
const second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
const milliSeconds = date.getMilliseconds();
const app = getApp()
// pages/user/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    fbstatus: 'none',
    headpic: '../../images/indexIcon/headerpic.png',
    logout: false,
    loginbtn: true,
    usernaemstatus: false,
    usernaem: '未登录',
    FjLoginLog: wx.getStorageSync('FjLoginLog'),
    mykefu: false,
    URankName: '',
    JiFen: '',
    isSigning: '', // 1表示签约了
    isAuthShort: false, // false 不提醒， true提醒
    Mobile: '',
    IsShopVideo: 0,
    ShopVideoMess: '本功能仅限VIP会员、旗舰会员、尊享会员发布!',
    CJshow: false,//采集单位弹框
    CaiJiUserTips: '',
    CJcomType: ['废金属', '再生塑料', '废纸', '铜厂、铜材厂', '调剂商、贸易商', '钢厂、钢铁冶金'],
    CJcomTypeIndex: 0,
    CaiJiUserTips: '',
    liuyantext: '',
    serviceName: '投诉热线',
    servicePhone: '',
    isShowAlert: false,
    showInlet: true,
    kf_name: '废旧客服',
    kf_phonenumber: '0311-87106666'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.queryServicePhone()

  },
  closeKefuAlert() {
    this.setData({ mykefu: false })
  },
  clickalert() {

  },
  myRelease: function () {
    if (app.checkFjLogin()) {
      this.mynavigateTo('myRelease');
    } else {
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }

  },
  myshoucang: function () {
    if (app.checkFjLogin()) {
      this.mynavigateTo('myshoucang');
    } else {
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }
  },
  mywyczshoucang: function () {
    if (app.checkFjLogin()) {
      wx.navigateTo({
        url: 'mywyczsp'
      });
    } else {
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }
  },
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    // 自定义tabbar切换
    if (typeof this.getTabBar === 'function' &&
      this.getTabBar()) {
      this.getTabBar().setData({
        selected: 4
      })
    };

    this.setData({
      showInlet: true
    })
    var FjLoginLog = wx.getStorageSync('FjLoginLog');
    var that = this
    if (FjLoginLog) {
      this.setData({
        logout: true,
        loginbtn: false,
        usernaemstatus: true,
        usernaem: FjLoginLog.UName
      })
      var url = "api/FeijiuApp/GetUserHeadPictureByUID?uid=" + FjLoginLog.UID + "&strRSA=";
      app.getDaoGet(url, function (res) {
        if (res.code == 200) {
          if (res.data != '') {
            that.setData({
              headpic: res.data
            })
          }
        }
      })
      var api_input = {
        uid: FjLoginLog.UID,
        upwd: FjLoginLog.UPwd
      }
      app.getDaoPost('api/FeijiuApp/Post_FJ_UserInfoByUID', api_input, function (r) {
        console.log(JSON.parse(app.aesDec(r.data)))
        if (r.code == 200) {
          var arr = JSON.parse(app.aesDec(r.data));
          that.setData({
            URankName: arr.URankName,
            JiFen: arr.JiFen,
            Mobile: arr.Uinfo[0].Mobile,
            IsShopVideo: arr.IsShopVideo,
            ShopVideoMess: arr.ShopVideoMess,
            isSigning: arr.isSigning,
          })
          if (arr.isSigning == '1') {
            that.getAuthorization()
          }
        }
      })
      var parameDic = {
        LoginUID: FjLoginLog.UID,
      }
      app.getDaoPost('api/FeijiuApp/Feijiu_Get_DingyuePopup', parameDic, function (r) {
        if (r.code == 200 && r.data == 1 && !that.data.isShowAlert) {
          that.setData({
            isShowAlert: true
          })
          wx.showModal({
            title: '温馨提示',
            content: '尊敬的用户，我们注意到您已经一段时间没有更新您的订阅词了。\r\n为了确保您收到的信息始终与您的行业和偏好保持一致，我们建议您尽快更新您的订阅词。\r\n感谢您对Feijiu网服务的支持和信任。',
            cancelText: '暂不修改',
            confirmText: '去修改',
            cancelColor: '#999999',
            confirmColor: '#029d11',
            success(res) {
              if (res.confirm) {
                wx.navigateTo({
                  url: '/pages/dingyue/keylist',
                })
              } else if (res.cancel) {
                app.getDaoPost('api/FeijiuApp/Feijiu_ADD_DingyuePopupRecord', parameDic, function (r) {
                });
              }
              that.setData({
                isShowAlert: false
              })
            }
          })

        }
      })
      // api/FeijiuApp/Feijiu_Get_SUAInfo
    } else {
      this.setData({
        fbstatus: 'none',
        headpic: '../../images/indexIcon/headerpic.png',
        logout: false,
        loginbtn: true,
        usernaemstatus: false,
        usernaem: 'Feijiu网',
      })
    }
    app.getOpenId();
  },
  // 资产处置合作生意通知
  // 判断客户是否授权过却未永久授权
  getAuthorization() {
    const _this = this
    var FjLoginLog = wx.getStorageSync('FjLoginLog')
    wx.request({
      url: app.data.api_url2 + "v/vip_mini_info/",
      header: {
        'content-type': 'application/x-www-form-urlencoded',
      },
      data: {
        user_id: FjLoginLog.UID,
      },
      method: 'POST',
      success: function (res) {
        if (res.statusCode == 200) {
          console.log(res.data, 'res.data.data,', res.data.data)
          _this.setData({
            // 0取消提醒，1设置提醒
            isAuthShort: res.data.data.alarm == 0 ? false : true
          })
        }
      }
    })
  },
  // 设置红点状态
  setIsAuthShort(sts) {
    const _this = this
    var FjLoginLog = wx.getStorageSync('FjLoginLog')
    wx.request({
      url: app.data.api_url2 + "v/vip_mini_alarm_set/",
      header: {
        'content-type': 'application/x-www-form-urlencoded',
      },
      data: {
        user_id: FjLoginLog.UID,
        sts: sts, // 0展示红点，1不展示红点'
      },
      method: 'POST',
      success: function (res) {
        if (res.statusCode == 200) {
          _this.setRecyclingPreference()
        }
      }
    })
  },
  // 签约客户授权
  noticeAuthorize() {
    if (!this.data.isAuthShort) {
      this.setRecyclingPreference()
      return
    }
    this.getSetting()
  },
  // 调取用户授权提示
  /**
   * 1. 没有点击永久授权，出现小红点，点击回收偏好，弹出消息提醒框，
        1. 若关闭通知总开关，则引导客户开启开关通知，之后再弹出消息提醒框
        2. 若开启，继续向下进行
    2. 若点击了永久授权，没有小红点，并且和总开关没有关系
   * wx.getSetting()
   *  obj.success{
   *    mainSwitch订阅消息总开关:true为开启，false为关闭
   *    itemSettings: 只返回用户勾选过订阅面板中的“总是保持以上选择，不再询问”的订阅消息
   *      'accept'表示用户同意订阅这条消息，
   *      'reject'表示用户拒绝订阅这条消息，
   *      'ban'表示已被后台封禁
   *  }
   */
  getSetting() {
    const _this = this
    wx.getSetting({
      withSubscriptions: true,
      success(r) {
        const { mainSwitch, itemSettings } = r.subscriptionsSetting
        if (itemSettings && itemSettings['TitWyia1OaPHEvk3tnoW1AQsn1Wib9ZewynqprgcEEQ']) {
          _this.setIsAuthShort(1)
        } else {
          if (!mainSwitch) {
            _this.openSetting()
            return
          }
          wx.requestSubscribeMessage({
            tmplIds: ['TitWyia1OaPHEvk3tnoW1AQsn1Wib9ZewynqprgcEEQ'],
            success() {
              // 操作成功之后再次获取判断有无永久授权
              wx.getSetting({
                withSubscriptions: true,
                success(r) {
                  const { itemSettings } = r.subscriptionsSetting
                  if (itemSettings && itemSettings['TitWyia1OaPHEvk3tnoW1AQsn1Wib9ZewynqprgcEEQ']) {
                    _this.setIsAuthShort(1)
                  } else {
                    _this.setIsAuthShort(0)
                  }
                }
              })
            },
            fail() {
              wx.showToast({
                title: '授权信息失败',
                icon: 'none'
              })
            }
          })
        }
      }
    })
  },

  // 打开订阅消息
  openSetting() {
    wx.showModal({
      title: '提示',
      content: '检测到您没有开启订阅消息的权限，是否去设置？',
      success: function (sm) {
        if (sm.confirm) {
          wx.openSetting()
        } else if (sm.cancel) {
          wx.showToast({
            title: '您没有同意授权订阅消息，订阅失败',
            icon: 'none'
          });
        }
      }
    })
  },

  // 设置回收偏好
  setRecyclingPreference() {
    // const url = this.data.isSigning == '1'
    //   ? '/packageB/pages/recyclingPreference/preference'
    //   : '/packageB/pages/hetong/hetong'
    // wx.navigateTo({
    //   url
    // })
    if (this.data.isSigning == '1') {
      wx.navigateTo({
        url: '/packageB/pages/recyclingPreference/preference',
      });
    } else {
      wx.navigateTo({
        url: '../other/otherWeb',
        success: function (res) {
          // 通过 eventChannel 向被打开页面传送数据
          res.eventChannel.emit('acceptDataFromOpenerPage', {
            url: 'https://wap.feijiu.net/zhuanti/zchz/index.aspx',
            // url: 'http://10.10.10.232:8081/zhuanti/zchz/index.aspx',
            pageSrc: 1,
          });
        },
      });
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  //关闭发布菜单
  shutdownfb: function () {
    this.setData({
      fbstatus: 'none'
    })
  },
  showInletChange: function () {
    this.setData({
      showInlet: false
    })
  },
  //点开发布菜单
  openfb: function () {
    this.setData({
      fbstatus: 'block'
    })
  },
  topage: function (e) {
    var that = this
    var page = e.currentTarget.dataset.ty;
    if (app.checkFjLogin()) {
      if (page == 'fbgy') {
        wx.navigateTo({
          // url: '../create/gongqiu?shid=1'
          url: '/packageB/pages/sellRelease/Acategorize/Acategorize?type=1'
        })
      }
      if (page == 'fbqg') {
        wx.navigateTo({
          // url: '../create/gongqiu?shid=2'
          url: '/packageB/pages/sellRelease/Acategorize/Acategorize?type=2',
        })
      }
      if (page == 'kscl') {
        wx.navigateTo({
          url: '/packageB/pages/quickRelease/quickIndex/quickIndex',
        })
      }
      if (page == 'fbsp') {
        this.choosevod()
      }
      if (page == 'wdfb') {
        this.mynavigateTo('myRelease')
      }
      if (page == 'sjsc') {
        this.mynavigateTo('myshoucang');
      }
      if (page == 'sjsd') {
        wx.navigateTo({
          url: 'suoding'
        });
      }
      if (page == 'sjdy') {
        wx.navigateTo({
          url: '../dingyue/keylist'
        });
      }
      if (page == 'wddy') {
        wx.switchTab({
          url: '../../pages/dingyue/index'
        })
      }
      if (page == 'wdkf') {
        this.mykefu()
        var FjLoginLog = wx.getStorageSync('FjLoginLog');
        var url = 'api/FeijiuApp/GetMyKefu?uid=' + FjLoginLog.UID + '&strRSA=';
        app.getDaoGet(url, function (r) {
          console.log(r)
          that.setData({
            kf_name: r.data.Name,
            kf_phonenumber: r.data.TouSuDianHua
          })
        })
      }
      if (page == 'wdzj') {
        this.tochakan()
      }
      if (page == 'wdsp') {
        this.towodeshangpu()
      }
      if (page == 'wybj') {
        this.queryisCJ()
      }
    } else {
      if (page == 'kscl') {
        wx.navigateTo({
          url: '/packageB/pages/quickRelease/quickIndex/quickIndex',
        })
        return false;
      }
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }
  },

  completemessage: function completemessage(res) {
    console.log(res, "res");
  },
  clickCell: function () {
    const url = 'api/FeijiuApp/Feijiu_Community_ClickADD'
    const LoginUID = wx.getStorageSync('FjLoginLog').UID ? wx.getStorageSync('FjLoginLog').UID : "0"
    const _this = this
    const click_platform = "4"
    const systemInfo = wx.getSystemInfoSync();
    const click_system = systemInfo.platform === 'ios' ? "2" : "1"
    app.getDaoPostN(url, { LoginUID, click_position: 4, click_platform, click_system }, function (res) {

    })
  },
  startmessage: function startmessage(e) {
    // const url = 'api/FeijiuApp/Feijiu_Community_ClickADD'
    // const LoginUID = wx.getStorageSync('FjLoginLog').UID
    // const _this=this
    // const click_platform="4"
    // const systemInfo = wx.getSystemInfoSync();
    // const click_system=systemInfo.platform === 'ios'?"2":"1"
    // app.getDaoPostN(url, {LoginUID,click_position:4,click_platform,click_system},function(res){

    // })
  },

  mynavigateTo: function (page) {
    if (app.checkFjLogin()) {
      wx.navigateTo({
        url: './' + page
      });
    } else {
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }
  },
  logout: function () {
    var that = this;
    wx.showModal({
      title: 'Feijiu网提示',
      content: '您确定要退出登录吗?',
      showCancel: true,
      cancelText: '取消',
      cancelColor: '#000000',
      confirmText: '确定',
      confirmColor: '#3CC51F',
      success: (res) => {
        if (res.confirm) {
          // wx.clearStorageSync();
          wx.removeStorageSync('openid')
          wx.removeStorageSync('sbtype')
          wx.removeStorageSync('sbname')
          wx.removeStorageSync('ip')
          wx.removeStorageSync('is_Yins')
          wx.removeStorageSync('FjLoginLog')
          that.setData({
            logout: false,
            loginbtn: true,
            usernaemstatus: false,
            headpic: '../../images/indexIcon/headerpic.png',
          })
        }

      },
    })

  },
  rengongfabu: function () {
    var that = this
    wx.showModal({
      title: '拨打电话发布信息',
      content: '0311-87106666',
      showCancel: true,
      cancelText: '取消',
      cancelColor: '#000000',
      confirmText: '确定',
      confirmColor: '#3CC51F',
      success: (res) => {
        if (res.confirm) {
          wx.makePhoneCall({
            phoneNumber: '0311-87106666'
          })
        }
      }
    })
  },
  mykefu: function (e) {
    this.setData({
      mykefu: true
    })
  },
  zichanfabu: function () {
    wx.navigateTo({
      url: '../create/zichan'
    })
  },
  gongqiufabu: function (e) {
    wx.navigateTo({
      url: '../create/gongqiu?shid=' + e.currentTarget.dataset.shid
    })
  },
  toyszc: function () {
    wx.navigateTo({
      url: '../login/toweb?url=https://apps.feijiu.net/app/yssm/'
    })
  },
  tozcxy: function () {
    wx.navigateTo({
      url: '../login/toweb?url=https://apps.feijiu.net/app/fwxy'
    })
  },
  toabout: function () {
    wx.navigateTo({
      url: '../login/toweb?url=https://apps.feijiu.net/app/qyjj'
    })
  },
  tochakan: function () {
    if (app.checkFjLogin()) {
      wx.navigateTo({
        url: 'chakan'
      });
    } else {
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }
  },
  tosuoding: function () {
    if (app.checkFjLogin()) {
      wx.navigateTo({
        url: 'suoding'
      });
    } else {
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }
  },


  towodeshangpu: function () {
    var that = this;
    var FjLoginLog = wx.getStorageSync('FjLoginLog');
    if (FjLoginLog.FjToken) {
      var api_input = {
        uid: FjLoginLog.UID
      }
      app.getDaoPostN('api/FeijiuApp/IsShop', api_input, function (r) {

        if (r.code == 200) {
          if (r.data.isShop == 1) {
            wx.navigateTo({
              url: '../gongqiuxinxi/shangpu?longUID=' + FjLoginLog.UID
            })
          } else {

            app.tishi('再发布任意' + r.data.NeedZc + '条供求信息,审核通过后,将自动开通商铺');
          }
        }
      })
    } else {
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }

    // api/FeijiuApp/IsShop
  },
  quxiao: function () {
    this.setData({
      mykefu: false
    })
  },
  tokefu: function () {
    var phone = this.data.kf_phonenumber;
    wx.makePhoneCall({
      phoneNumber: phone
    })
    this.setData({
      mykefu: false
    })
  },
  tosystem: function () {
    if (app.checkFjLogin()) {
      wx.navigateTo({
        url: '../../pages/system/index'
      });
    } else {
      wx.navigateTo({
        url: '../../pages/login/index'
      });
    }
  },
  // 投诉
  handlyTousu() {
    wx.makePhoneCall({
      phoneNumber: this.data.servicePhone
    })
    return;
    // wx.showModal({
    //   content: this.data.servicePhone,
    //   showCancel: true,
    //   title: this.data.serviceName,
    //   success: (res) => {
    //     if (res.confirm) {
    //       console.log('用户点击确定')
    //       wx.makePhoneCall({
    //         phoneNumber: this.data.servicePhone
    //       })
    //     } else if (res.cancel) {
    //       console.log('用户点击取消')
    //     }
    //   },
    // })
  },
  queryServicePhone(e) {
    app.getDaoPost('api/FeijiuApp/Feijiu_Get_FJTel', { type: 25017 }, r => {
      console.log(r, '客服电话')
      if (r.code == 200) {
        this.setData({
          servicePhone: r.data[0].Tel,
          serviceName: r.data[0].Name
        })
      }
    })
  },
  /**
   * 上传视频
   * @return {[type]} [description]
   */
  choosevod: function () {
    if (this.data.IsShopVideo != 1) {
      app.tishi(this.data.ShopVideoMess);
      return false;
    } else {
      app.tishi('此功能仅限app使用');
      return false;
    }
    // var that = this;
    // wx.chooseVideo({
    //   sourceType: ['album', 'camera'],
    //   maxDuration: 60,
    //   camera: 'back',
    //   success(r) {
    //     // console.log(r);return false;
    //     if (r.size > 10000000) {
    //       app.tishi('您上传的视频已超过10M!请缩小后再上传!');
    //       return false;
    //     }
    //     var index = r.tempFilePath.lastIndexOf("\.");
    //     var kuozhan = r.tempFilePath.substring(index + 1, r.tempFilePath.length);
    //     var name = that.Appendzero(day) + '' + hour + '' + minute + '' + second + '' + milliSeconds + '' + that.threeRand() + '.' + kuozhan;
    //     var vodSrc = r.tempFilePath;
    //     wx.showLoading({
    //       title: "视频正在上传中"
    //     })
    //     upyun.upload({
    //       localPath: vodSrc,
    //       remotePath: '/video/shop/' + year + '/' + that.Appendzero(month) + '/' + that.Appendzero(day) + '/' + name,
    //       success: function (res) {
    //         wx.showToast({
    //           title: '上传成功',
    //           icon: 'success',
    //           duration: 1000
    //         })
    //         if (res.statusCode == 200) {
    //           res.data = JSON.parse(res.data);
    //           if (res.data.code == 200) {
    //             setTimeout(function () {
    //               wx.navigateTo({
    //                 url: '../shipin/edit?url=' + res.data.url + '&duration=' + Math.round(r.duration) + '&type=1&navindex=3'
    //               })
    //             }, 1000)
    //           } else {
    //             app.tishi('视频上传失败,请重试!')
    //           }

    //         } else {
    //           app.tishi('视频上传失败,请重试!')
    //         }
    //       },
    //       fail: function ({
    //         errMsg
    //       }) {
    //         console.log('uploadImage fail, errMsg is', errMsg)
    //       },
    //     })
    //   }
    // })
  },
  Appendzero: function (obj) {
    if (obj < 10) return "0" + "" + obj;
    else return obj;
  },
  threeRand: function () {
    var rand = "";
    for (var i = 0; i < 3; i++) {
      var r = Math.floor(Math.random() * 10);
      rand += r;
    }
    return rand;
  },
  // 申请成为采集单位
  applyCJ() {
    let that = this
    // LoginUID 登录用户编号     CompanyType 公司类型名称    Message 留言   CompanyName 公司名  LinkMan 联系人姓名   LinkTel 联系人电话
    if (!this.data.Linkman) {
      wx.showToast({
        title: '请填写联系人',
        icon: 'none'
      })
      return
    } else if (!this.data.Mobile) {
      wx.showToast({
        title: '请填写联系方式',
        icon: 'none'
      })
      return
    } else if (this.data.Mobile.length < 11) {
      wx.showToast({
        title: '手机号格式不正确',
        icon: 'none'
      })
      return
    }
    let input = {
      LoginUID: wx.getStorageSync('FjLoginLog').UID,
      CompanyType: this.data.CJcomType[this.data.CJcomTypeIndex],
      Message: this.data.liuyantext,
      CompanyName: this.data.ComName ? this.data.ComName : '',
      LinkMan: this.data.Linkman,
      LinkTel: this.data.Mobile
    }
    wx.showModal({
      title: '温馨提示',
      content: '是否申请采集单位',
      success(res) {
        if (res.confirm) {
          console.log('用户点击确定')
          app.getDaoPost('api/FeijiuApp/Feijiu_BJ_apply_CollectUser', input, r => {
            // console.log(r, '采集单位申请')
            if (r.code == 200) {
              wx.showToast({
                title: r.data,
                icon: 'none'
              })
              that.setData({
                CJshow: false
              })
            } else {
              wx.showToast({
                title: r.message,
                icon: 'none'
              })
            }
          })
        } else if (res.cancel) {
          console.log('用户点击取消')
          // that.setData({
          //   CJshow: false
          // })
        }
      }
    })
  },
  //查询是不是采集单位 有没有登录
  async queryisCJ() {
    let that = this
    if (app.checkFjLogin()) {
      var FjLoginLog = wx.getStorageSync('FjLoginLog');
      var api_input = {
        uid: FjLoginLog.UID,
        upwd: FjLoginLog.UPwd
      }
      //采集单位
      await app.getDaoPost('api/FeijiuApp/Post_FJ_UserInfoByUID', api_input, function (r) {
        var udata = JSON.parse(app.aesDec(r.data));
        // console.log(udata, '===采集单位');
        that.setData({
          ComName: udata.Uinfo[0].ComName,
          Linkman: udata.Uinfo[0].Linkman,
          Mobile: udata.Uinfo[0].Mobile,
          isCaiJiUser: udata.isCaiJiUser,
          CaiJiUserTips: udata.CaiJiUserTips
        })
        if (udata.isCaiJiUser == 0) { //1 是 0不是没有提交申请 2不是提交过
          that.setData({
            CJshow: true,
          })
        } else if (udata.isCaiJiUser == 2) { //
          wx.showToast({
            title: udata.CaiJiUserTips,
            icon: 'none'
          })

        } else if (udata.isCaiJiUser == 1) {
          wx.navigateTo({
            url: `/packageB/pages/mybaojia/index?cjname=${udata.Uinfo[0].Linkman}&cjphone=${udata.Uinfo[0].Mobile}&cjcomp=${udata.Uinfo[0].ComName}`,
          })
        }

      })
    } else {
      wx.navigateTo({
        url: '/pages/login/index'
      });
    }
  },
  onCloseCJ() {
    this.setData({
      CJshow: false
    })
  },
  selectComType(e) {
    let index = e.currentTarget.dataset.index
    this.setData({
      CJcomTypeIndex: index
    })
  },
  GJcomInput(e) {
    this.setData({
      ComName: e.detail.value
    })
  },
  GJUserPhoneInput(e) {
    this.setData({
      Mobile: e.detail.value
    })
  },
  GJUserNameInput(e) {
    this.setData({
      Linkman: e.detail.value
    })
  },
  liuyanInput(e) {
    this.setData({
      liuyantext: e.detail.value
    })
  },
})